#include <stdio.h>
#include <unistd.h>  

#include "common.h"
#include "clientFunction.h"
#include "maskGen.c"

int clientFunction(job_t* job)
{
	
	int i;
	chunk(job->pwdMin,job->pwdMax,job->charsetNumber,job->start,job->stop);
	unsigned char hash[16];
	unsigned char cmp[16];
	memcpy(cmp, job->hash, 16);
	
	for(i=0;i<JOB_SIZE*16;i++)
	{
		char input[16];
		memcpy(input, memPartagee+i, 16);
		MDString(input, hash);
		if(memcmp(cmp, hash, 16))
		{
			return wordToIndice(job->charsetNumber, input);
		}
	}
  
  return (-1);
}
